import request from '@/utils/request'

// 查询结构详细
export function getStructure(id) {
  return request({
    url: '/fmea/common/structure/' + id,
    method: 'get'
  })
}

// 查询关注要素
export function queryFocusElement(data) {
  return request({
    url: `/fmea/common/structure/queryFocusElement`,
    method: 'get',
    params: data
  })
}

export function getTaskInfo(id) {
  return request({
    url: '/fmea/common/projectStructureTask/getInfoByStructureId/' + id,
    method: 'get'
  })
}

// 新增结构
export function addStructure(data) {
  return request({
    url: '/fmea/common/structure',
    method: 'post',
    data: data
  })
}

// 批量新增结构
export function addBatchStructure(data) {
  return request({
    url: '/fmea/common/structure/batch',
    method: 'post',
    data: data
  })
}

// 修改结构
export function updateStructure(data) {
  return request({
    url: '/fmea/common/structure',
    method: 'put',
    data: data
  })
}

// 删除结构
export function delStructure(id) {
  return request({
    url: '/fmea/common/structure/' + id,
    method: 'delete'
  })
}

// 检查结构是否唯一
export function checkStructureUnique(params) {
  return request({
    url: '/fmea/common/structure/checkStructureUnique',
    method: 'get',
    params: params
  })
}

// 保存任务
export function saveTask(data) {
  return request({
    url: '/fmea/common/projectStructureTask',
    method: 'put',
    data: data
  })
}
